package com.tuo.beans.enums;

/**
 * Created by tuo on 2016/1/12.
 */
public enum Algorithm {
    /**
     * 一次性，只收取一次费用
     */
    ONCE("1", "一次"),
    /**
     * 按照实际天数计算
     */
    BYDAY("2", "天数"),
    /**
     * 按照面积计算
     */
    BYAREA("3", "面积"),
    /**
     * 按照固定天数计算
     */
    FIXEDDAY("4", "固定天数");

    private final String value;
    private final String description;

    Algorithm(String value, String description) {
        this.value = value;
        this.description = description;
    }

    public String getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }

    public static Algorithm get(String value) {
        for (Algorithm algorithm : values()) {
            if (algorithm.getValue().equals(value)) {
                return algorithm;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return this.value;
    }
}
